package com.dragon.mmochat.model.object;

import java.awt.Color;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.dragon.mmochat.MmochatConstant;
import com.dragon.mmochat.model.MmochatSerial;
import com.dragon.mmochat.model.enumType.MmochatCommonObjectType;
import com.dragon.mmochat.model.enumType.MmochatDrugType;
import com.dragon.mmochat.model.enumType.MmochatEquipAttributeType;
import com.dragon.mmochat.model.enumType.MmochatEquipGiftType;
import com.dragon.mmochat.model.enumType.MmochatEquipQualityType;
import com.dragon.mmochat.model.enumType.MmochatEquipSexType;
import com.dragon.mmochat.model.enumType.MmochatEquipType;
import com.dragon.mmochat.model.enumType.MmochatEquipVersion;
import com.dragon.mmochat.model.enumType.MmochatLifeSkillType;
import com.dragon.mmochat.model.enumType.MmochatMaterialType;
import com.dragon.mmochat.model.enumType.MmochatObjOwnerState;
import com.dragon.mmochat.model.enumType.MmochatObjectType;
import com.dragon.mmochat.model.enumType.MmochatPropEffectType;
import com.dragon.mmochat.model.enumType.MmochatPropType;
import com.dragon.mmochat.model.enumType.MmochatPropUsingCondition;
import com.dragon.mmochat.model.enumType.MmochatPropUsingRoleType;
import com.dragon.mmochat.model.enumType.MmochatSecondRoleType;
import com.dragon.mmochat.model.enumType.MmochatSuperMachineType;
import com.dragon.mmochat.model.role.MmochatPet;
import com.dragon.mmochat.model.role.MmochatPlayer;
import com.dragon.mmochat.service.MmochatEquipService;
import com.dragon.mmochat.service.MmochatLifeSkillService;
import com.dragon.mmochat.service.MmochatMainService;
import com.dragon.mmochat.service.MmochatPkMachineService;
import com.dragon.mmochat.util.MmochatUtil;
import com.google.gson.reflect.TypeToken;

//物品
//objectId是transient类型的，故在序列化或GSON时不会保存
//deepClone方式不会调用构造函数，从而可能导致objectId未初始化，故不能使用deepClone
//GSON会调用构造函数，但不能将抽象成员和父类成员字符串化，故此类不能有“抽象成员”和“父类成员”
//注意：生成装备时，必需使用MmochatEquip子类来实现。如果直接用MmochatCommonObject，需要注意配置equipVersion！！！
public class MmochatCommonObject implements Serializable, Cloneable {
	private static final long serialVersionUID = 8800838124139359998L;
	protected static transient MmochatSerial serial = new MmochatSerial(); // 用于生成id
	protected transient int objectId;// 物品ID:临时生成,不保存数据库

	/**************** 通用属性 ****************/
	protected MmochatObjectType objectType;// 物品类型:药品,装备,道具,材料,法宝等
	protected int overlapNum = 1;// 叠加数量
	// 物品属性
	protected boolean canOverlap = true;// 是否允许叠加:叠加有上限
	protected boolean canDeal = true;// 能否交易
	protected boolean canDrop = true; // 能否丟弃
	protected long sellPrice = 0; // 商店出售定价，只有摆放到商店时才需要
	protected boolean bind = false; // 是否绑定,绑定后不可丟弃
	protected MmochatObjOwnerState ownerState = MmochatObjOwnerState.未认主; // 是否认主，认主后不可交易，丟弃，回收(自动取消绑定状态)；解除认主需要10天时间；解除后自动进入绑定状态
	protected long releaseOwnerStartTime = 0;// 开始解除认主时间
	protected Integer borrowFromRoleId = null;// 所有者roleId。当出借时需要设置

	/**************** 个性属性 ****************/
	// 宠物属性
	protected MmochatPet pet = null; // 用于保存宠物信息
	protected String objInfo = null; // 只有宠物在交易时需要设置此项
	protected int objBmpId = 0;// 只有宠物在交易时需要设置此项

	// 药品属性类型
	protected MmochatDrugType drugType = null;// 药品类型

	// 材料属性
	protected MmochatMaterialType materialType = null;// 材料类型

	// 道具属性
	protected MmochatPropType propType = null;// 道具类型
	protected int curPropAmount = 0; // 当前道具总量
	// ----黑白水晶
	protected MmochatEquipAttribute equipAttrInProp = null; // 道具中吸附的装备属性
	protected int levelOfEquipAttrInProp = 0; // 道具中吸附的装备属性的等级
	protected MmochatEquipType equipTypeOfEquipAttrInProp = null; // 道具中吸附的装备属性的类型
	// ----经验道行丹
	protected Integer minUseLevelOfProp = null; // 道具使用等级下限
	protected Integer maxUseLevelOfProp = null; // 道具使用等级上限
	protected Integer expAmountOfPropForPlayer = null; // 使用道具增加玩家经验量
	protected Integer daoAmountOfPropForPlayer = null; // 使用道具增加玩家道行量
	protected Integer expAmountOfPropForPet = null; // 使用道具增加宠物经验量
	protected Integer daoAmountOfPropForPet = null; // 使用道具增加宠物武学量
	protected Integer propLevel = null; // 道具等级
	protected Long startTick = null;// 开始使用时间
	// ----武魂石
	protected MmochatEquipAttribute pkStoneBaseAttr = null;// 基础属性
	protected MmochatEquipAttribute pkStoneAttr = null;// 技能类型
	protected int levelLimit = 1;// 技能石等级上限
	protected int exp = 0;// 技能石灵气

	// 装备属性
	protected MmochatEquipVersion equipVersion = null;
	protected String equipMaker = null; // 装备制作人(粉化、绿化操作时更新此项)
	protected String equipName = null; // 装备名
	protected MmochatEquipQualityType equipQuality = null; // 品质
	protected int equipLevelNeed = 1; // 装备等级
	protected int equipExtraLevel = 0; // 升级装备时增加的等级
	protected MmochatEquipSexType equipSexNeed = MmochatEquipSexType.中性装; // 性别要求
	protected MmochatEquipType equipType = null; // 装备类型
	protected MmochatEquipGiftType equipGiftType = null;// 套装类型
	protected int equipModifyLevel = 0;// 改造等级
	protected Integer equipUserRoleId = null;// 当前装备使用人(使用中才算，放在包裹中不算)
	protected List<MmochatEquipAttribute> equipBaseAttr = new ArrayList<MmochatEquipAttribute>();// 基本属性
	protected List<MmochatEquipAttribute> equipRandAttr = new ArrayList<MmochatEquipAttribute>();// 随机属性
	protected MmochatEquipAttribute equipPinkAttr = null;// 粉装属性
	protected MmochatEquipAttribute equipGreenLightAttr = null;// 套装明属性
	protected MmochatEquipAttribute equipGreenDarkAttr = null;// 套装暗属性
	// 改造属性
	protected Map<MmochatEquipAttributeType, MmochatEquipAttribute> equipModifyAttr = new ConcurrentHashMap<MmochatEquipAttributeType, MmochatEquipAttribute>();
	// 转生属性
	protected Map<MmochatEquipAttributeType, MmochatEquipAttribute> equipLifeTurnAttr = new ConcurrentHashMap<MmochatEquipAttributeType, MmochatEquipAttribute>();
	protected int life_turn = 0; // 装备转生次数
	protected MmochatSecondRoleType second_role_type = MmochatSecondRoleType.未转生;

	// 神行法宝属性
	public static int flyMachineMaxSpeedLevel = 3;
	public static int flyMachineMaxFlyLevel = 5;
	protected MmochatSuperMachineType superMachineType = null; // 法宝类型
	protected int flyMachineSpeedLevel = 1; // 神行法宝:速度等级(1,2,3)
	protected int flyMachineFlyLevel = 0; // 神行法宝:腾空等级(0,1,2,3,4,5)
	protected long flyMachineUseStartTime = (new Date()).getTime(); // 神行法宝:消耗体力的起点时间(体力用完后，重新补充体力时，需要重置此项)
	protected long flyMachineCanUseTotalValue = 0; // 神行法宝:总体力(数据库中保存的体力)
	protected long flyMachineCanUseValue = 0; // 神行法宝:当前体力(根据时间计算出来的当前剩余体力)
	protected int flyMachineExp = 0; // 神行法宝:法宝升级灵气
	protected List<MmochatEquipAttribute> flyMachineAttr = new ArrayList<MmochatEquipAttribute>();// 神行法宝:法宝增加属性

	// 武魂法宝属性
	// protected MmochatSuperMachineType superMachineType = null; // 法宝类型
	protected int pkMachineStar = 1;// 星级，决定最大技能数
	protected List<MmochatCommonObject> pkMachineSkills = new ArrayList<MmochatCommonObject>();// 技能列表

	// GSON回导会调用此构造函数
	public MmochatCommonObject() {
		// 从数据库读取对象时，ID重新临时生成
		objectId = serial.addAndGetSerialId();
	}

	public MmochatCommonObject getClone() {
		MmochatCommonObject obj = (MmochatCommonObject) MmochatUtil.deepClone(
				this, new TypeToken<MmochatCommonObject>() {
				}.getType());
		obj.setObjectId(objectId);
		obj.setEquipModifyAttr(obj.getEquipModifyAttr());
		obj.setEquipLifeTurnAttr(obj.getEquipLifeTurnAttr());
		MmochatPet pet = obj.getPet();
		if (pet != null) {
			pet.setPetId(obj.getPet().getId());
		}
		return obj;
	}

	public MmochatCommonObject getCloneWithNewId() {
		MmochatCommonObject obj = (MmochatCommonObject) MmochatUtil.deepClone(
				this, new TypeToken<MmochatCommonObject>() {
				}.getType());
		obj.setEquipModifyAttr(obj.getEquipModifyAttr());
		obj.setEquipLifeTurnAttr(obj.getEquipLifeTurnAttr());
		MmochatPet pet = obj.getPet();
		if (pet != null) {
			pet.setPetId(obj.getPet().getId());
		}
		return obj;
	}

	public void setNewId() {
		objectId = serial.addAndGetSerialId();
	}

	public int getId() {
		return objectId;
	}

	public void setObjectId(int objectId) {
		this.objectId = objectId;
	}

	public MmochatObjectType getObjectType() {
		return objectType;
	}

	public void setObjectType(MmochatObjectType objectType) {
		this.objectType = objectType;
	}

	public boolean isCanOverlap() {
		return canOverlap;
	}

	public void setCanOverlap(boolean canOverlap) {
		this.canOverlap = canOverlap;
	}

	public int getOverlapNum() {
		return overlapNum;
	}

	public void setOverlapNum(int overlapNum) {
		this.overlapNum = overlapNum;
		this.overlapNum = Math.max(this.overlapNum, 0);
	}

	public void addOverlapNum(int add) {
		overlapNum += add;
		overlapNum = Math.max(overlapNum, 0);
	}

	public void delOverlapNum(int del) {
		overlapNum -= del;
		overlapNum = Math.max(overlapNum, 0);
	}

	public boolean isCanDeal() {
		if (ownerState != MmochatObjOwnerState.未认主) {
			return false;
		}
		return canDeal;
	}

	public void setCanDeal(boolean canDeal) {
		this.canDeal = canDeal;
	}

	public MmochatDrugType getDrugType() {
		return drugType;
	}

	public void setDrugType(MmochatDrugType drugType) {
		this.drugType = drugType;
	}

	public MmochatMaterialType getMaterialType() {
		return materialType;
	}

	public void setMaterialType(MmochatMaterialType materialType) {
		this.materialType = materialType;
	}

	public MmochatPropType getPropType() {
		return propType;
	}

	public void setPropType(MmochatPropType propType) {
		this.propType = propType;
	}

	public int getCurPropAmount() {
		return curPropAmount;
	}

	public void setCurPropAmount(int curPropAmount) {
		this.curPropAmount = curPropAmount;
	}

	public String getEquipName() {
		return equipName;
	}

	public void setEquipName(String equipName) {
		this.equipName = equipName;
	}

	public MmochatEquipQualityType getEquipQuality() {
		return equipQuality;
	}

	public void setEquipQuality(MmochatEquipQualityType equipQuality) {
		this.equipQuality = equipQuality;
	}

	public int getEquipLevelNeed() {
		return equipLevelNeed;
	}

	public int getEquipTrueLevel() {
		return equipLevelNeed + life_turn * 10;
	}

	public void setEquipLevelNeed(int equipLevelNeed) {
		this.equipLevelNeed = equipLevelNeed;
	}

	public void addEquipLevelNeed(int add) {
		this.equipLevelNeed += add;
	}

	public MmochatEquipSexType getEquipSexNeed() {
		return equipSexNeed;
	}

	public void setEquipSexNeed(MmochatEquipSexType equipSexNeed) {
		this.equipSexNeed = equipSexNeed;
	}

	public MmochatEquipType getEquipType() {
		return equipType;
	}

	public void setEquipType(MmochatEquipType equipType) {
		this.equipType = equipType;
	}

	public List<MmochatEquipAttribute> getEquipBaseAttr() {
		return equipBaseAttr;
	}

	public void setEquipBaseAttr(List<MmochatEquipAttribute> equipBaseAttr) {
		this.equipBaseAttr = equipBaseAttr;
	}

	public List<MmochatEquipAttribute> getEquipRandAttr() {
		return equipRandAttr;
	}

	public void setEquipRandAttr(List<MmochatEquipAttribute> equipRandAttr) {
		this.equipRandAttr = equipRandAttr;
	}

	public int getEquipModifyLevel() {
		return equipModifyLevel;
	}

	public Map<MmochatEquipAttributeType, MmochatEquipAttribute> getEquipModifyAttr() {
		return equipModifyAttr;
	}

	public void setEquipModifyAttr(
			Map<MmochatEquipAttributeType, MmochatEquipAttribute> equipModifyAttr) {
		this.equipModifyAttr = new ConcurrentHashMap<MmochatEquipAttributeType, MmochatEquipAttribute>(
				equipModifyAttr);
	}

	public MmochatEquipAttribute getEquipPinkAttr() {
		return equipPinkAttr;
	}

	public void setEquipPinkAttr(MmochatEquipAttribute equipPinkAttr) {
		this.equipPinkAttr = equipPinkAttr;
	}

	public MmochatEquipAttribute getEquipGreenLightAttr() {
		return equipGreenLightAttr;
	}

	public void setEquipGreenLightAttr(MmochatEquipAttribute equipGreenLightAttr) {
		this.equipGreenLightAttr = equipGreenLightAttr;
	}

	public MmochatEquipAttribute getEquipGreenDarkAttr() {
		return equipGreenDarkAttr;
	}

	public void setEquipGreenDarkAttr(MmochatEquipAttribute equipGreenDarkAttr) {
		this.equipGreenDarkAttr = equipGreenDarkAttr;
	}

	public MmochatEquipGiftType getEquipGiftType() {
		return equipGiftType;
	}

	public void setEquipGiftType(MmochatEquipGiftType equipGiftType) {
		this.equipGiftType = equipGiftType;
	}

	public String getEquipMaker() {
		return equipMaker;
	}

	public void setEquipMaker(String equipMaker) {
		this.equipMaker = equipMaker;
	}

	public MmochatEquipAttribute getEquipAttrInProp() {
		return equipAttrInProp;
	}

	public void setEquipAttrInProp(MmochatEquipAttribute equipAttrInProp) {
		this.equipAttrInProp = equipAttrInProp;
	}

	public int getLevelOfEquipAttrInProp() {
		return levelOfEquipAttrInProp;
	}

	public void setLevelOfEquipAttrInProp(int levelOfEquipAttrInProp) {
		this.levelOfEquipAttrInProp = levelOfEquipAttrInProp;
	}

	public MmochatEquipType getEquipTypeOfEquipAttrInProp() {
		return equipTypeOfEquipAttrInProp;
	}

	public void setEquipTypeOfEquipAttrInProp(
			MmochatEquipType equipTypeOfEquipAttrInProp) {
		this.equipTypeOfEquipAttrInProp = equipTypeOfEquipAttrInProp;
	}

	public Integer getEquipUserRoleId() {
		return equipUserRoleId;
	}

	public void setEquipUserRoleId(Integer equipUserRoleId) {
		this.equipUserRoleId = equipUserRoleId;
	}

	public int getFlyMachineSpeedLevel() {
		return flyMachineSpeedLevel;
	}

	public void setFlyMachineSpeedLevel(int flyMachineSpeedLevel) {
		this.flyMachineSpeedLevel = flyMachineSpeedLevel;
	}

	public int getFlyMachineFlyLevel() {
		return flyMachineFlyLevel;
	}

	public void setFlyMachineFlyLevel(int flyMachineFlyLevel) {
		this.flyMachineFlyLevel = flyMachineFlyLevel;
		switch (flyMachineFlyLevel) {
		case 1: {
			// 全属性
			flyMachineAttr.clear();
			MmochatEquipAttribute attr = new MmochatEquipAttribute();
			attr.setType(MmochatEquipAttributeType.全属性);
			attr.setValue(6);
			flyMachineAttr.add(attr);
			break;
		}
		case 2: {
			flyMachineAttr.clear();
			MmochatEquipAttribute attr = new MmochatEquipAttribute();
			attr.setType(MmochatEquipAttributeType.全属性);
			attr.setValue(10);
			flyMachineAttr.add(attr);
			break;
		}
		case 3: {
			flyMachineAttr.clear();
			MmochatEquipAttribute attr = new MmochatEquipAttribute();
			attr.setType(MmochatEquipAttributeType.全属性);
			attr.setValue(14);
			flyMachineAttr.add(attr);
			break;
		}
		case 4: {
			flyMachineAttr.clear();
			MmochatEquipAttribute attr = new MmochatEquipAttribute();
			attr.setType(MmochatEquipAttributeType.全属性);
			attr.setValue(18);
			flyMachineAttr.add(attr);
			break;
		}
		case 5: {
			flyMachineAttr.clear();
			MmochatEquipAttribute attr = new MmochatEquipAttribute();
			attr.setType(MmochatEquipAttributeType.全属性);
			attr.setValue(20);
			flyMachineAttr.add(attr);
			break;
		}
		default:
			break;
		}
	}

	public long getFlyMachineUseStartTime() {
		return flyMachineUseStartTime;
	}

	public void setFlyMachineUseStartTime(long flyMachineUseStartTime) {
		this.flyMachineUseStartTime = flyMachineUseStartTime;
	}

	public long getFlyMachineCanUseValue() {
		return flyMachineCanUseValue;
	}

	public void setFlyMachineCanUseValue(long flyMachineCanUseValue) {
		this.flyMachineCanUseValue = flyMachineCanUseValue;
	}

	public void addFlyMachineCanUseValue(int add) {
		this.flyMachineCanUseValue += add;
	}

	public int getFlyMachineExp() {
		return flyMachineExp;
	}

	public void setFlyMachineExp(int flyMachineExp) {
		this.flyMachineExp = flyMachineExp;
	}

	public void delFlyMachineExp(int del) {
		flyMachineExp -= del;
	}

	public void addFlyMachineExp(int add) {
		if ((long) Integer.MAX_VALUE - flyMachineExp < add) {
			flyMachineExp = Integer.MAX_VALUE;
		} else {
			flyMachineExp += add;
		}
	}

	public List<MmochatEquipAttribute> getFlyMachineAttr() {
		return flyMachineAttr;
	}

	public void setFlyMachineAttr(List<MmochatEquipAttribute> flyMachineAttr) {
		this.flyMachineAttr = flyMachineAttr;
	}

	public MmochatSuperMachineType getSuperMachineType() {
		return superMachineType;
	}

	public void setSuperMachineType(MmochatSuperMachineType superMachineType) {
		this.superMachineType = superMachineType;
	}

	public boolean isCanDrop() {
		if (isBind()) {
			return false;
		}
		if (ownerState != MmochatObjOwnerState.未认主) {
			return false;
		}
		if (borrowFromRoleId != null) {
			return false;
		}
		return canDrop;
	}

	public void setCanDrop(boolean canDrop) {
		this.canDrop = canDrop;
	}

	public Integer getMinUseLevelOfProp() {
		return minUseLevelOfProp;
	}

	public void setMinUseLevelOfProp(Integer minUseLevelOfProp) {
		this.minUseLevelOfProp = minUseLevelOfProp;
	}

	public Integer getMaxUseLevelOfProp() {
		return maxUseLevelOfProp;
	}

	public void setMaxUseLevelOfProp(Integer maxUseLevelOfProp) {
		this.maxUseLevelOfProp = maxUseLevelOfProp;
	}

	public Integer getExpAmountOfPropForPlayer() {
		return expAmountOfPropForPlayer;
	}

	public void setExpAmountOfPropForPlayer(Integer expAmountOfPropForPlayer) {
		this.expAmountOfPropForPlayer = expAmountOfPropForPlayer;
	}

	public Integer getDaoAmountOfPropForPlayer() {
		return daoAmountOfPropForPlayer;
	}

	public void setDaoAmountOfPropForPlayer(Integer daoAmountOfPropForPlayer) {
		this.daoAmountOfPropForPlayer = daoAmountOfPropForPlayer;
	}

	public Integer getExpAmountOfPropForPet() {
		return expAmountOfPropForPet;
	}

	public void setExpAmountOfPropForPet(Integer expAmountOfPropForPet) {
		this.expAmountOfPropForPet = expAmountOfPropForPet;
	}

	public Integer getDaoAmountOfPropForPet() {
		return daoAmountOfPropForPet;
	}

	public void setDaoAmountOfPropForPet(Integer daoAmountOfPropForPet) {
		this.daoAmountOfPropForPet = daoAmountOfPropForPet;
	}

	public long getFlyMachineCanUseTotalValue() {
		return flyMachineCanUseTotalValue;
	}

	public void setFlyMachineCanUseTotalValue(long flyMachineCanUseTotalValue) {
		this.flyMachineCanUseTotalValue = flyMachineCanUseTotalValue;
	}

	public void addFlyMachineCanUseTotalValue(long add) {
		if (Long.MAX_VALUE - flyMachineCanUseTotalValue < add) {
			flyMachineCanUseTotalValue = Long.MAX_VALUE;
		} else {
			this.flyMachineCanUseTotalValue += add;
		}
	}

	public int getEquipExtraLevel() {
		return equipExtraLevel;
	}

	public void setEquipExtraLevel(int equipExtraLevel) {
		this.equipExtraLevel = equipExtraLevel;
	}

	public void addEquipExtraLevel(int add) {
		equipExtraLevel += add;
	}

	public long getSellPrice() {
		return sellPrice;
	}

	public void setSellPrice(long sellPrice) {
		this.sellPrice = sellPrice;
	}

	public MmochatEquipVersion getEquipVersion() {
		return equipVersion;
	}

	public void setEquipVersion(MmochatEquipVersion equipVersion) {
		this.equipVersion = equipVersion;
	}

	// TODO
	// 设置装备改造等级
	public void setEquipModifyLevel(int modifyLevel) {
		if (modifyLevel < 0) {
			modifyLevel = 0;
		}
		List<MmochatEquipAttributeType> attrTypeList = new ArrayList<MmochatEquipAttributeType>();
		switch (equipType) {
		case 武器:
			attrTypeList.add(MmochatEquipAttributeType.伤害);
			break;
		case 头盔:
			attrTypeList.add(MmochatEquipAttributeType.防御);
			attrTypeList.add(MmochatEquipAttributeType.气血);
			break;
		case 衣服:
			attrTypeList.add(MmochatEquipAttributeType.防御);
			attrTypeList.add(MmochatEquipAttributeType.免伤);
			break;
		case 鞋子:
			attrTypeList.add(MmochatEquipAttributeType.防御);
			attrTypeList.add(MmochatEquipAttributeType.速度);
			break;
		default:
			return;
		}
		// 改造数值
		equipModifyAttr.clear();
		this.equipModifyLevel = modifyLevel;
		if (equipModifyLevel > 0) {
			for (MmochatEquipAttributeType attrType : attrTypeList) {
				MmochatEquipAttribute attr = new MmochatEquipAttribute();
				int modifyValue = MmochatEquipService.getEquipModifyValue(
						equipType, equipLevelNeed, attrType, modifyLevel);
				attr.setType(attrType);
				attr.setValue(modifyValue);
				equipModifyAttr.put(attrType, attr);
			}
		}

		if (life_turn > 0) {
			// 有转生属性
			equipLifeTurnAttr.clear();
			if (equipModifyLevel > 0) {
				for (MmochatEquipAttributeType attrType : attrTypeList) {
					MmochatEquipAttribute attr = new MmochatEquipAttribute();
					int modifyValue = MmochatEquipService.getEquipModifyValue(
							equipType, getEquipTrueLevel(), attrType,
							modifyLevel)
							- MmochatEquipService.getEquipModifyValue(
									equipType, equipLevelNeed, attrType,
									modifyLevel);
					if (attrType == MmochatEquipAttributeType.伤害) {
						// 如果是武器，那么根据仙魔属性进行设置
						if (second_role_type == MmochatSecondRoleType.仙道) {
							attrType = MmochatEquipAttributeType.法伤;
						} else if (second_role_type == MmochatSecondRoleType.魔道) {
							attrType = MmochatEquipAttributeType.物伤;
						}
					}
					attr.setType(attrType);
					attr.setValue(modifyValue);
					equipLifeTurnAttr.put(attrType, attr);
				}
			}
		}
	}

	// 获取装备某种属性的总数值
	public int getEquipAttrValue(MmochatEquipAttributeType attrType) {
		int sum = 0;
		for (MmochatEquipAttribute attr : equipBaseAttr) {
			if (attr.getType() == attrType) {
				sum += attr.getValue();
			}
		}
		for (MmochatEquipAttribute attr : equipRandAttr) {
			if (attr.getType() == attrType) {
				sum += attr.getValue();
			}
		}
		if (equipPinkAttr != null) {
			if (equipPinkAttr.getType() == attrType) {
				sum += equipPinkAttr.getValue();
			}
		}
		if (equipGreenLightAttr != null) {
			if (equipGreenLightAttr.getType() == attrType) {
				sum += equipGreenLightAttr.getValue();
			}
		}
		// 暗属性只有成套穿身上后才有效果
		if (equipGreenDarkAttr != null) {
			if (equipUserRoleId != null) {
				MmochatPlayer equipUser = MmochatMainService.players
						.get(equipUserRoleId);
				if (equipUser != null
						&& equipUser.isAllWeaponedEquipTheSameSet()) {
					if (equipGreenDarkAttr.getType() == attrType) {
						int modifyParam = equipUser
								.getCountOfMaxModifiedWeaponedEquip() + 1;
						sum += equipGreenDarkAttr.getValue() * modifyParam;
					}
				}
			}
		}
		// 改造数值
		for (MmochatEquipAttribute attr : equipModifyAttr.values()) {
			if (attr.getType() == attrType) {
				sum += attr.getValue();
			}
		}

		// 进化改造数值
		for (MmochatEquipAttribute attr : equipLifeTurnAttr.values()) {
			if (attr.getType() == attrType) {
				sum += attr.getValue();
			}
		}

		// 法宝属性数值
		if (flyMachineCanUseValue > 0) {
			for (MmochatEquipAttribute attr : flyMachineAttr) {
				if (attr.getType() == attrType) {
					sum += attr.getValue();
				}
			}
		}

		// 武魂技能，武魂基础属性
		int minValue = 10000;
		for (MmochatCommonObject sub : pkMachineSkills) {
			// 基础属性，取武魂石最小值
			if (sub.getPkStoneBaseAttr() != null) {
				if (sub.getPkStoneBaseAttr().getType() == attrType) {
					minValue = Math.min(sub.getPkStoneBaseAttr().getValue(),
							minValue);
				}
			}
			// 武魂石技能
			if (sub.getPkStoneAttr() != null) {
				if (sub.getPkStoneAttr().getType() == attrType) {
					sum += sub.getPkStoneAttr().getValue();
				}
			}
		}
		if (minValue != 10000) {
			sum += minValue;
		}

		return sum;
	}

	// 获取神行法宝名字
	public static String getFlyMachineName(int speedLevel) {
		String names[] = new String[] { "追风", "绝影", "浮云" };
		if (speedLevel <= names.length) {
			return names[speedLevel - 1];
		}		
		return "浮云";
	}

	// 获取神行法宝每小时体力消耗值
	public static int getFlyMachineUsePerHour(int speedLevel, int flyLevel) {
		int useValue[] = new int[] { 9, 9, 9, 5, 5, 3, 3, 3 };
		int trueLevel = speedLevel + flyLevel - 1;
		if (trueLevel < useValue.length) {
			return useValue[trueLevel];
		}
		return 3;
	}

	// 获取神行法宝升级所需灵气
	public static int getFlyMachineUplevelNeed(int curSpeedLevel,
			int curFlyLevel) {
		int useValue[] = new int[] { 8000, 20000, 8000, 14000, 22000, 30000,
				42000, 0 };
		int trueLevel = curSpeedLevel + curFlyLevel - 1;
		if (trueLevel < useValue.length) {
			return useValue[trueLevel];
		}
		return 0;
	}

	// 能否回收;赠品不可回收
	public boolean canSell() {
		if (isBind()) {
			return false;
		}
		if (ownerState != MmochatObjOwnerState.未认主) {
			return false;
		}

		if (borrowFromRoleId != null) {
			return false;
		}
		if (isCanDeal()) {
			switch (objectType) {
			case 装备:
			case 法宝:{
				return true;
			}
			default:
				break;
			}
		}
		return false;
	}

	// 能否出借
	public boolean canBorrow() {
		switch (objectType) {
		case 装备:
		case 法宝:
		case 宠物: {
			return true;
		}
		default:
			break;
		}
		return false;
	}

	// 获取系统回收价
	public int getPriceOfSellToSystem() {
		int price = 0;
		if (!canSell()) {
			return 0;
		}
		switch (objectType) {
		case 装备: {
			return MmochatEquipService.getEquipSellToSystemPrice(this);
		}
		case 法宝:{
			return 1;
		}
		default:
			break;
		}
		return price;
	}

	// 能否在战斗中使用
	public boolean canUseInBattle() {
		switch (objectType) {
		case 药品: {
			return true;
		}
		case 道具: {
			if (propType.getUseCondition() == MmochatPropUsingCondition.战斗时使用
					|| propType.getUseCondition() == MmochatPropUsingCondition.任何时候使用) {
				return true;
			}
			break;
		}
		default:
			break;
		}
		return false;
	}

	// 能否喂宠
	public boolean canFeedPet() {
		switch (objectType) {
		case 药品: {
			return true;
		}
		case 道具: {
			if (propType.getUseRole() == MmochatPropUsingRoleType.宠物
					|| propType.getUseRole() == MmochatPropUsingRoleType.所有) {
				return true;
			}
			break;
		}
		default:
			break;
		}
		return false;
	}

	public int getBmpId() {
		switch (objectType) {
		case 药品:
			return drugType.getBmpId();
		case 装备:
			return equipType.getBmpId();
		case 材料:
			return materialType.getBmpId();
		case 道具:
			return propType.getBmpId();
		case 法宝:
			return superMachineType.getBmpId();
		case 宠物:
			if (pet != null) {
				return pet.getBmpType().getValue();
			}
			break;
		default:
			break;
		}
		return objBmpId;
	}

	public String getName() {
		switch (objectType) {
		case 药品:
			return drugType.toString();
		case 装备:
			return equipName;
		case 材料:
			return materialType.toString();
		case 道具:
			return propType.toString();
		case 法宝:
			if (superMachineType != null) {
				if (superMachineType == MmochatSuperMachineType.神行法宝) {
					return getFlyMachineName(flyMachineSpeedLevel);
				} else if (superMachineType == MmochatSuperMachineType.武魂) {
					return pkMachineStar + "星" + superMachineType.toString();
				}
			}
		case 宠物:
			if (pet != null) {
				return pet.getPetTypeName();
			}
			break;
		default:
			break;
		}
		return null;
	}

	// 网页上显示的交易物品信息
	public String getDealLogInfo() {
		switch (objectType) {
		case 药品: {
			String info = "";
			info += drugType.toString() + ":" + overlapNum + "个";
			return info;
		}
		case 装备: {
			String detail = "";
			String title = "";
			if (equipGiftType != null) {
				detail += equipGiftType.toString() + "套装";
				if (second_role_type != MmochatSecondRoleType.未转生) {
					detail += "(" + second_role_type.toString() + ")";
				}
				detail += "<br/>";
			}
			title += equipName;
			if (equipModifyLevel > 0) {
				title += "(+" + equipModifyLevel + ")";
			}
			detail += title;
			detail += "(" + overlapNum + "件)";
			if (equipMaker != null) {
				detail += "<br/>" + equipMaker + "出品";
			}
			detail += "<br/>类型:" + equipType.toString();
			detail += "<br/>等级:" + equipLevelNeed + "级";
			if (equipExtraLevel > 0) {
				detail += "(+" + equipExtraLevel + "级)";
			}
			if (life_turn > 0) {
				detail += "(" + life_turn + "转)";
			}
			detail += "<br/>品质:" + equipQuality.toString();

			// 基础属性
			for (MmochatEquipAttribute attr : equipBaseAttr) {
				int extraAttrValue = 0;
				for (MmochatEquipAttribute extraAttr : equipRandAttr) {
					if (extraAttr.getType() == attr.getType()) {
						extraAttrValue += extraAttr.getValue();
					}
				}
				if (equipPinkAttr != null
						&& equipPinkAttr.getType() == attr.getType()) {
					extraAttrValue += equipPinkAttr.getValue();
				}
				for (MmochatEquipAttribute extraAttr : equipModifyAttr.values()) {
					if (extraAttr.getType() == attr.getType()) {
						extraAttrValue += extraAttr.getValue();
					}
				}
				for (MmochatEquipAttribute extraAttr : equipLifeTurnAttr
						.values()) {
					if (extraAttr.getType() == attr.getType()) {
						extraAttrValue += extraAttr.getValue();
					}
				}
				detail += "<br/>" + attr.getType().getStartInfo() + ":"
						+ (attr.getValue() + extraAttrValue)
						+ attr.getType().getEndInfo();
			}
			// 附加属性
			for (MmochatEquipAttribute attr : equipRandAttr) {
				detail += "<br/>" + attr.getType().getStartInfo() + "+"
						+ attr.getValue() + attr.getType().getEndInfo();
			}
			// 粉属性
			if (equipPinkAttr != null) {
				detail += "<br/>" + equipPinkAttr.getType().getStartInfo()
						+ "+" + equipPinkAttr.getValue()
						+ equipPinkAttr.getType().getEndInfo();
			}
			// 套装明属性
			if (equipGreenLightAttr != null) {
				detail += "<br/>"
						+ equipGreenLightAttr.getType().getStartInfo() + "+"
						+ equipGreenLightAttr.getValue()
						+ equipGreenLightAttr.getType().getEndInfo();
			}
			// 套装暗属性
			if (equipGreenDarkAttr != null) {
				detail += "<br/>" + equipGreenDarkAttr.getType().getStartInfo()
						+ "+" + equipGreenDarkAttr.getValue()
						+ equipGreenDarkAttr.getType().getEndInfo();
			}

			// 改造属性
			for (MmochatEquipAttribute attr : equipModifyAttr.values()) {
				if (attr.getValue() > 0) {
					detail += "<br/>改造" + attr.getType().getStartInfo() + "+"
							+ attr.getValue() + attr.getType().getEndInfo();
				}
			}
			for (MmochatEquipAttribute attr : equipLifeTurnAttr.values()) {
				if (attr.getValue() > 0) {
					detail += "<br/>进化" + attr.getType().getStartInfo() + "+"
							+ attr.getValue() + attr.getType().getEndInfo();
				}
			}
			return detail;
		}
		case 材料: {
			String info = "";
			info += materialType.toString() + ":" + overlapNum + "个";
			return info;
		}
		case 道具: {
			String info = "";
			info += propType.toString() + ":" + overlapNum + "个";
			if (propType.getAmount() > 1) {
				info += "<br/>剩余:" + curPropAmount;
			}
			if (propLevel != null) {
				info += "<br/>等级:" + propLevel;
			}
			if (equipAttrInProp != null) {
				// 道具吸附属性
				String attrInfo = "吸附属性<br/>";
				attrInfo += "等级：" + levelOfEquipAttrInProp + "<br/>";
				attrInfo += "类型：" + equipTypeOfEquipAttrInProp.toString()
						+ "<br/>";
				attrInfo += "属性：" + equipAttrInProp.getType().getStartInfo()
						+ "+" + equipAttrInProp.getValue()
						+ equipAttrInProp.getType().getEndInfo() + "<br/>";
				info += "<br/>" + attrInfo;
			}
			if (minUseLevelOfProp != null) {
				String levelInfo = "<br/>使用等级下限：" + minUseLevelOfProp;
				info += levelInfo;
			}
			if (maxUseLevelOfProp != null) {
				String levelInfo = "<br/>使用等级上限：" + maxUseLevelOfProp;
				info += levelInfo;
			}
			if (expAmountOfPropForPlayer != null) {
				String amountInfo = "<br/>使用后增加玩家" + expAmountOfPropForPlayer
						+ "点经验!";
				info += amountInfo;
			}
			if (daoAmountOfPropForPlayer != null) {
				String amountInfo = "<br/>使用后增加玩家" + daoAmountOfPropForPlayer
						+ "点道行!";
				info += amountInfo;
			}
			if (expAmountOfPropForPet != null) {
				String amountInfo = "<br/>使用后增加宠物" + expAmountOfPropForPet
						+ "点经验!";
				info += amountInfo;
			}
			if (daoAmountOfPropForPet != null) {
				String amountInfo = "<br/>使用后增加宠物" + daoAmountOfPropForPet
						+ "点武学!";
				info += amountInfo;
			}
			// 特殊道具处理
			switch (propType) {
			case 三魂丹:
			case 七魄丹:
			case 妙手回春丹:
			case 魂魄归位丹: {
				if (propLevel != null) {
					int level = propLevel;
					switch (propType) {
					case 三魂丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.三魂炼丹术;
						int keepRound = MmochatLifeSkillService.getKeepRound(
								skillType, level);
						int defendRound = MmochatLifeSkillService
								.getDefendTimes(skillType, level);
						double effectValue = MmochatLifeSkillService
								.getEffectValue(skillType, level);
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "<br/>最大持续回合:" + keepRound;
						drugInfo += "<br/>抵御物攻次数:" + defendRound;
						drugInfo += "<br/>累积抵御物伤:" + (int) effectValue;
						drugInfo += "<br/>消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;
					}
					case 七魄丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.七魄炼丹术;
						int keepRound = MmochatLifeSkillService.getKeepRound(
								skillType, level);
						int defendRound = MmochatLifeSkillService
								.getDefendTimes(skillType, level);
						double effectValue = MmochatLifeSkillService
								.getEffectValue(skillType, level);
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "<br/>最大持续回合:" + keepRound;
						drugInfo += "<br/>抵御法攻次数:" + defendRound;
						drugInfo += "<br/>累积抵御法伤:" + (int) effectValue;
						drugInfo += "<br/>消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;

					}
					case 妙手回春丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.妙手回春炼丹术;
						int keepRound = MmochatLifeSkillService.getKeepRound(
								skillType, level);
						double effectValue = MmochatLifeSkillService
								.getEffectValue(skillType, level);
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "<br/>最大持续回合:" + keepRound;
						drugInfo += "<br/>首次回血比例:" + (int) (100 * effectValue)
								+ "%";
						drugInfo += "<br/>消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;

					}
					case 魂魄归位丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.魂魄归位炼丹术;
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "<br/>消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;
					}
					default:
						break;
					}
					if (propType.getEffectType() == MmochatPropEffectType.限时不限量
							|| propType.getEffectType() == MmochatPropEffectType.限时) {
						String timeInfo = "";
						if (startTick == null) {
							timeInfo += "<br/>时限:"
									+ (propType.getEffectAmount() / MmochatConstant.MS_PER_HOUR)
									+ "小时";
						} else {
							long costTime = System.currentTimeMillis()
									- startTick;
							long restTime = propType.getEffectAmount()
									- costTime;
							timeInfo += "<br/>时限:剩余"
									+ MmochatUtil.getMinString(restTime);
						}
						info += timeInfo;
					}
					if (propType.getEffectType() == MmochatPropEffectType.限时不限量) {
						if (startTick == null) {
							info += "<br/>未开始计时(首次使用后计时)";
						} else {
							info += "<br/>时限内可无限次使用";
						}
					}

				}
				break;
			}
			case 武魂石: {
				if (pkStoneAttr == null || pkStoneBaseAttr == null) {
					info += "<br/>未鉴定";
				} else {
					info += "<br/>等级上限:" + levelLimit;
					int uplevelExp = MmochatPkMachineService
							.getUplevelExpForPkStone(propLevel);
					info += "<br/>升级灵气:" + exp + "/" + uplevelExp;
					info += "<br/>基础类型:"
							+ pkStoneBaseAttr.getType().getStartInfo() + "+"
							+ pkStoneBaseAttr.getValue()
							+ pkStoneBaseAttr.getType().getEndInfo();
					info += "<br/>技能类型:" + pkStoneAttr.getType().getStartInfo()
							+ "+" + pkStoneAttr.getValue()
							+ pkStoneAttr.getType().getEndInfo();
				}
				break;
			}
			default:
				break;
			}
			return info;
		}
		case 法宝: {
			String info = "";
			if (superMachineType == MmochatSuperMachineType.神行法宝) {
				String title = getFlyMachineName(flyMachineSpeedLevel);
				if (flyMachineSpeedLevel == 3 && flyMachineFlyLevel == 5) {
					title += "(飞行形态)";
				}
				info += title + "<br/>";
				info += "类型：" + superMachineType.toString() + "<br/>";
				info += "等级：" + (flyMachineSpeedLevel + flyMachineFlyLevel)
						+ "级<br/>";
				info += "移动：" + flyMachineSpeedLevel + "阶<br/>";
				info += "腾空：" + flyMachineFlyLevel + "阶<br/>";
				info += "体力："
						+ (flyMachineCanUseValue > 0 ? flyMachineCanUseValue
								: "0") + "<br/>";
				info += "消耗：每小时"
						+ getFlyMachineUsePerHour(flyMachineSpeedLevel,
								flyMachineFlyLevel) + "体力<br/>";
				info += "升级灵气："
						+ flyMachineExp
						+ "/"
						+ getFlyMachineUplevelNeed(flyMachineSpeedLevel,
								flyMachineFlyLevel) + "<br/>";

				switch (flyMachineSpeedLevel) {
				case 1:
					info += "行走速度+28%";
					break;
				case 2:
					info += "行走速度+43%";
					break;
				case 3:
					info += "行走速度+57%";
					break;
				default:
					break;
				}
				for (MmochatEquipAttribute attr : flyMachineAttr) {
					info += "<br/>" + attr.getType().getStartInfo() + "+"
							+ attr.getValue() + attr.getType().getEndInfo();
				}
				if (flyMachineCanUseValue <= 0) {
					info += "<br/>(体力不足，效果未激活)";
				}
			} else if (superMachineType == MmochatSuperMachineType.武魂) {
				info += superMachineType.toString() + "<br/>";
				String star = "";
				for (int i = 0; i < pkMachineStar; i++) {
					star += "★";
				}
				info += "品质:" + star + "<br/>";
				info += "可镶嵌技能石:" + pkMachineStar + "<br/>";
				int skillCount = 0;
				MmochatEquipAttribute minBaseAttr = null;
				String skillInfo = "";
				for (MmochatCommonObject stone : pkMachineSkills) {
					if (stone != null) {
						if (stone.getPkStoneBaseAttr() != null) {
							if (minBaseAttr == null) {
								minBaseAttr = stone.getPkStoneBaseAttr();
							} else if (minBaseAttr.getValue() > stone
									.getPkStoneBaseAttr().getValue()) {
								minBaseAttr = stone.getPkStoneBaseAttr();
							}
						}
						if (stone.getPkStoneAttr() != null) {
							skillInfo += "("
									+ stone.getPropLevel()
									+ "级)"
									+ stone.getPkStoneAttr().getType()
											.getStartInfo()
									+ "+"
									+ stone.getPkStoneAttr().getValue()
									+ stone.getPkStoneAttr().getType()
											.getEndInfo() + "<br/>";
							skillCount++;
						}
					}
				}
				if (minBaseAttr != null) {
					info += "基础类型:" + minBaseAttr.getType().getStartInfo()
							+ "+" + minBaseAttr.getValue()
							+ minBaseAttr.getType().getEndInfo() + "<br/>";
				}
				info += skillInfo;
				for (int i = skillCount; i < pkMachineStar; i++) {
					info += "未镶嵌<br/>";
				}
			} else {
				info += superMachineType.toString();
			}
			return info;
		}
		case 宠物: {
			return objInfo;
		}
		default:
			break;
		}
		return objInfo;

	}

	public String getInfo() {
		return getInfo(false);
	}

	// isInShop:是否在商店中出售的信息(出售时不显示回收价格，只显示出售价格)
	public String getInfo(boolean isInShop) {
		switch (objectType) {
		case 药品: {
			String info = "";
			if (isInShop) {
				info += MmochatUtil.wrapColor("出售单价:\n"
						+ MmochatUtil.getColorMoney(sellPrice)
						+ "文钱\n￣￣￣￣￣￣￣￣￣￣\n", Color.yellow);
			}
			if (!canDeal) {
				info += MmochatUtil.wrapColor("不可交易\n", Color.red);
			}
			info += MmochatUtil.wrapColor(drugType.toString(), Color.white)
					+ "\n";
			info += MmochatUtil.wrapIcon(drugType.getBmpId()) + "\n";
			info += MmochatUtil.wrapColor(drugType.getInfo(), Color.white);
			return info;
		}
		case 装备: {
			// TODO
			String detail = "";
			if (borrowFromRoleId != null) {
				detail += MmochatUtil.wrapColor("出借者ID:"
						+ Integer.toHexString(borrowFromRoleId * 3) + "\n",
						Color.red);
			}
			if (isInShop) {
				detail += MmochatUtil.wrapColor("出售单价:\n"
						+ MmochatUtil.getColorMoney(sellPrice)
						+ "文钱\n￣￣￣￣￣￣￣￣￣￣\n", Color.yellow);
			} else {
				detail += MmochatUtil.wrapColor("回收价格:", Color.white);
				detail += MmochatUtil.getColorMoney(MmochatEquipService
						.getEquipSellToSystemPrice(this))
						+ MmochatUtil.wrapColor("文\n", Color.white);
			}
			if (!canDeal) {
				detail += MmochatUtil.wrapColor("不可交易\n", Color.red);
			}
			switch (ownerState) {
			case 未认主: {
				if (bind) {
					detail += MmochatUtil.wrapColor("已绑定,不可遗弃\n", Color.green);
				}
				break;
			}
			case 已认主: {
				detail += MmochatUtil.wrapColor("已认主,不可交易或遗弃\n", Color.green);
				break;
			}
			case 解除认主中: {
				long releaseTime = releaseOwnerStartTime
						+ MmochatConstant.releaseOwnerInterval;
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				String t = sdf.format(new Date(releaseTime));
				detail += MmochatUtil.wrapColor(t + "解除认主\n", Color.red);
				break;
			}
			default:
				break;
			}
			if (equipGiftType != null) {
				detail += MmochatUtil.wrapColor(
						equipGiftType.toString() + "套装", Color.yellow);
				if (second_role_type != MmochatSecondRoleType.未转生) {
					detail += MmochatUtil.wrapColor("("
							+ second_role_type.toString() + ")", Color.magenta);
				}
				detail += "\n";
			} else {
				if (second_role_type != MmochatSecondRoleType.未转生) {
					detail += MmochatUtil.wrapColor(second_role_type.toString()
							+ "装备", Color.magenta);
				}
				detail += "\n";
			}
			String title = "";
			title += equipName;
			if (equipModifyLevel > 0) {
				title += "(+" + equipModifyLevel + ")";
			}
			detail += MmochatUtil.wrapColor(title, equipQuality.getColor())
					+ "\n";
			if (equipMaker != null) {
				detail += MmochatUtil.wrapColor(equipMaker + "出品\n", Color.red);
			}
			detail += MmochatUtil.wrapIcon(equipType.getBmpId());
			detail += "\n类型:" + equipType.toString();
			detail += "\n等级:" + equipLevelNeed + "级";
			if (equipExtraLevel > 0) {
				detail += MmochatUtil.wrapColor("(+" + equipExtraLevel + "级)",
						Color.yellow);
			}
			if (life_turn > 0) {
				detail += MmochatUtil.wrapColor("(" + life_turn + "转)",
						Color.yellow);
			}
			detail += "\n品质:" + equipQuality.toString();

			// 基础属性
			for (MmochatEquipAttribute attr : equipBaseAttr) {
				int extraAttrValue = 0;
				for (MmochatEquipAttribute extraAttr : equipRandAttr) {
					if (extraAttr.getType() == attr.getType()) {
						extraAttrValue += extraAttr.getValue();
					}
				}
				if (equipPinkAttr != null
						&& equipPinkAttr.getType() == attr.getType()) {
					extraAttrValue += equipPinkAttr.getValue();
				}
				for (MmochatEquipAttribute extraAttr : equipModifyAttr.values()) {
					if (extraAttr.getType() == attr.getType()) {
						extraAttrValue += extraAttr.getValue();
					}
				}
				for (MmochatEquipAttribute extraAttr : equipLifeTurnAttr
						.values()) {
					if (extraAttr.getType() == attr.getType()) {
						extraAttrValue += extraAttr.getValue();
					}
				}
				detail += "\n"
						+ MmochatUtil.wrapColor(attr.getType().getStartInfo()
								+ ":"
								+ MmochatUtil.wrapColor(
										(attr.getValue() + extraAttrValue)
												+ attr.getType().getEndInfo(),
										extraAttrValue == 0 ? Color.white
												: Color.cyan), Color.white);
			}
			// 附加属性
			for (MmochatEquipAttribute attr : equipRandAttr) {
				detail += "\n"
						+ MmochatUtil.wrapColor(attr.getType().getStartInfo()
								+ "+" + attr.getValue()
								+ attr.getType().getEndInfo(), Color.cyan);
			}
			// 粉属性
			if (equipPinkAttr != null) {
				detail += "\n"
						+ MmochatUtil.wrapColor(equipPinkAttr.getType()
								.getStartInfo()
								+ "+"
								+ equipPinkAttr.getValue()
								+ equipPinkAttr.getType().getEndInfo(),
								Color.magenta);
			}
			// 套装明属性
			if (equipGreenLightAttr != null) {
				detail += "\n"
						+ MmochatUtil.wrapColor(equipGreenLightAttr.getType()
								.getStartInfo()
								+ "+"
								+ equipGreenLightAttr.getValue()
								+ equipGreenLightAttr.getType().getEndInfo(),
								Color.green);
			}
			// 套装暗属性
			if (equipGreenDarkAttr != null) {
				// 套装成套穿上身后，暗属性变亮
				String darkInfo = equipGreenDarkAttr.getType().getStartInfo()
						+ "+" + equipGreenDarkAttr.getValue()
						+ equipGreenDarkAttr.getType().getEndInfo();

				String modifyEffect = darkInfo;
				Color color = Color.gray;
				if (!isInShop) {
					modifyEffect = "N倍(" + darkInfo + ")\nN为改20套装数量+1";

					if (equipUserRoleId != null) {
						MmochatPlayer equipUser = MmochatMainService.players
								.get(equipUserRoleId);
						if (equipUser != null
								&& equipUser.isAllWeaponedEquipTheSameSet()) {
							color = Color.green;
							int modifyParam = equipUser
									.getCountOfMaxModifiedWeaponedEquip() + 1;
							modifyEffect = modifyParam + "倍(" + darkInfo + ")";
						}
					}
				}

				detail += "\n" + MmochatUtil.wrapColor(modifyEffect, color);
			}
			// 改造属性
			for (MmochatEquipAttribute attr : equipModifyAttr.values()) {
				if (attr.getValue() > 0) {
					detail += "\n"
							+ MmochatUtil
									.wrapColor("改造"
											+ attr.getType().getStartInfo()
											+ "+" + attr.getValue()
											+ attr.getType().getEndInfo(),
											Color.yellow);
				}
			}

			// 转生改造属性
			for (MmochatEquipAttribute attr : equipLifeTurnAttr.values()) {
				if (attr.getValue() > 0) {
					detail += "\n"
							+ MmochatUtil
									.wrapColor("进化"
											+ attr.getType().getStartInfo()
											+ "+" + attr.getValue()
											+ attr.getType().getEndInfo(),
											Color.yellow);
				}
			}
			return detail;
		}
		case 材料: {
			String info = "";
			if (isInShop) {
				info += MmochatUtil.wrapColor("出售单价:\n"
						+ MmochatUtil.getColorMoney(sellPrice)
						+ "文钱\n￣￣￣￣￣￣￣￣￣￣\n", Color.yellow);
			}
			if (!canDeal) {
				info += MmochatUtil.wrapColor("不可交易\n", Color.red);
			}
			info += MmochatUtil.wrapColor(materialType.toString(), Color.white)
					+ "\n";
			info += MmochatUtil.wrapIcon(materialType.getBmpId()) + "\n";
			info += MmochatUtil.wrapColor(materialType.getInfo(), Color.white);
			return info;
		}
		case 道具: {
			String info = "";
			if (isInShop) {
				info += MmochatUtil.wrapColor("出售单价:\n"
						+ MmochatUtil.getColorMoney(sellPrice)
						+ "文钱\n￣￣￣￣￣￣￣￣￣￣\n", Color.yellow);
			}
			if (!canDeal) {
				info += MmochatUtil.wrapColor("不可交易\n", Color.red);
			}
			info += MmochatUtil.wrapColor(propType.toString(), Color.yellow)
					+ "\n";
			info += MmochatUtil.wrapIcon(propType.getBmpId()) + "\n";
			info += MmochatUtil.wrapColor(propType.getInfo(), Color.white);
			if (propLevel != null) {
				info += MmochatUtil
						.wrapColor("\n等级:" + propLevel, Color.yellow);
			}
			if (propType.getAmount() > 1) {
				info += MmochatUtil.wrapColor("\n剩余:" + curPropAmount,
						Color.yellow);
			}
			if (equipAttrInProp != null) {
				// 道具吸附属性
				String attrInfo = "吸附属性\n";
				attrInfo += "等级：" + levelOfEquipAttrInProp + "\n";
				attrInfo += "类型：" + equipTypeOfEquipAttrInProp.toString()
						+ "\n";
				attrInfo += "属性：" + equipAttrInProp.getType().getStartInfo()
						+ "+" + equipAttrInProp.getValue()
						+ equipAttrInProp.getType().getEndInfo() + "\n";
				info += MmochatUtil.wrapColor("\n\n" + attrInfo, Color.green);
			}
			if (minUseLevelOfProp != null) {
				String levelInfo = "\n使用等级下限：" + minUseLevelOfProp;
				info += levelInfo;
			}
			if (maxUseLevelOfProp != null) {
				String levelInfo = "\n使用等级上限：" + maxUseLevelOfProp;
				info += levelInfo;
			}
			if (expAmountOfPropForPlayer != null) {
				String amountInfo = "\n使用后增加玩家" + expAmountOfPropForPlayer
						+ "点经验!";
				info += amountInfo;
			}
			if (daoAmountOfPropForPlayer != null) {
				String amountInfo = "\n使用后增加玩家" + daoAmountOfPropForPlayer
						+ "点道行!";
				info += amountInfo;
			}
			if (expAmountOfPropForPet != null) {
				String amountInfo = "\n使用后增加宠物" + expAmountOfPropForPet
						+ "点经验!";
				info += amountInfo;
			}
			if (daoAmountOfPropForPet != null) {
				String amountInfo = "\n使用后增加宠物" + daoAmountOfPropForPet
						+ "点武学!";
				info += amountInfo;
			}

			// 特殊道具处理
			switch (propType) {
			case 三魂丹:
			case 七魄丹:
			case 妙手回春丹:
			case 魂魄归位丹: {
				if (propLevel != null) {
					int level = propLevel;
					switch (propType) {
					case 三魂丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.三魂炼丹术;
						int keepRound = MmochatLifeSkillService.getKeepRound(
								skillType, level);
						int defendRound = MmochatLifeSkillService
								.getDefendTimes(skillType, level);
						double effectValue = MmochatLifeSkillService
								.getEffectValue(skillType, level);
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "\n最大持续回合:" + keepRound;
						drugInfo += "\n抵御物攻次数:" + defendRound;
						drugInfo += "\n累积抵御物伤:" + (int) effectValue;
						drugInfo += "\n消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;
					}
					case 七魄丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.七魄炼丹术;
						int keepRound = MmochatLifeSkillService.getKeepRound(
								skillType, level);
						int defendRound = MmochatLifeSkillService
								.getDefendTimes(skillType, level);
						double effectValue = MmochatLifeSkillService
								.getEffectValue(skillType, level);
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "\n最大持续回合:" + keepRound;
						drugInfo += "\n抵御法攻次数:" + defendRound;
						drugInfo += "\n累积抵御法伤:" + (int) effectValue;
						drugInfo += "\n消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;

					}
					case 妙手回春丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.妙手回春炼丹术;
						int keepRound = MmochatLifeSkillService.getKeepRound(
								skillType, level);
						double effectValue = MmochatLifeSkillService
								.getEffectValue(skillType, level);
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "\n最大持续回合:" + keepRound;
						drugInfo += "\n首次回血比例:" + (int) (100 * effectValue)
								+ "%";
						drugInfo += "\n消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;

					}
					case 魂魄归位丹: {
						MmochatLifeSkillType skillType = MmochatLifeSkillType.魂魄归位炼丹术;
						int costSprit = MmochatLifeSkillService.getCostSprit(
								skillType, level);
						String drugInfo = "\n消耗法力:" + costSprit;
						drugInfo = MmochatUtil
								.wrapColor(drugInfo, Color.yellow);
						info += drugInfo;
						break;
					}
					default:
						break;
					}
					if (propType.getEffectType() == MmochatPropEffectType.限时不限量
							|| propType.getEffectType() == MmochatPropEffectType.限时) {
						String timeInfo = "";
						if (startTick == null) {
							timeInfo += "\n时限:"
									+ (propType.getEffectAmount() / MmochatConstant.MS_PER_HOUR)
									+ "小时";
						} else {
							long costTime = System.currentTimeMillis()
									- startTick;
							long restTime = propType.getEffectAmount()
									- costTime;
							timeInfo += "\n时限:剩余"
									+ MmochatUtil.getMinString(restTime);
						}
						timeInfo = MmochatUtil.wrapColor(timeInfo, Color.green);
						info += timeInfo;
					}
					if (propType.getEffectType() == MmochatPropEffectType.限时不限量) {
						if (startTick == null) {
							info += "\n未开始计时(首次使用后计时)";
						} else {
							info += "\n时限内可无限次使用";
						}
					}

				}
				break;
			}
			case 武魂石: {
				if (pkStoneAttr == null || pkStoneBaseAttr == null) {
					info += MmochatUtil.wrapColor("\n未鉴定", Color.magenta);
				} else {
					info += MmochatUtil.wrapColor("\n等级上限:" + levelLimit,
							Color.yellow);
					int uplevelExp = MmochatPkMachineService
							.getUplevelExpForPkStone(propLevel);
					info += MmochatUtil.wrapColor("\n升级灵气:" + exp + "/"
							+ uplevelExp, Color.yellow);
					info += MmochatUtil.wrapColor("\n基础类型:"
							+ pkStoneBaseAttr.getType().getStartInfo() + "+"
							+ pkStoneBaseAttr.getValue()
							+ pkStoneBaseAttr.getType().getEndInfo(),
							Color.green);
					info += MmochatUtil
							.wrapColor("\n技能类型:"
									+ pkStoneAttr.getType().getStartInfo()
									+ "+" + pkStoneAttr.getValue()
									+ pkStoneAttr.getType().getEndInfo(),
									Color.magenta);
				}
				break;
			}
			default:
				break;
			}
			return info;
		}
		case 法宝: {
			String info = "";
			if (borrowFromRoleId != null) {
				info += MmochatUtil.wrapColor("出借者ID:"
						+ Integer.toHexString(borrowFromRoleId * 3) + "\n",
						Color.red);
			}
			if (isInShop) {
				info += MmochatUtil.wrapColor("出售单价:\n"
						+ MmochatUtil.getColorMoney(sellPrice)
						+ "文钱\n￣￣￣￣￣￣￣￣￣￣\n", Color.yellow);
			}
			if (!canDeal) {
				info += MmochatUtil.wrapColor("不可交易\n", Color.red);
			}
			switch (ownerState) {
			case 未认主: {
				if (bind) {
					info += MmochatUtil.wrapColor("已绑定,不可遗弃\n", Color.green);
				}
				break;
			}
			case 已认主: {
				info += MmochatUtil.wrapColor("已认主,不可交易或遗弃\n", Color.green);
				break;
			}
			case 解除认主中: {
				long releaseTime = releaseOwnerStartTime
						+ MmochatConstant.releaseOwnerInterval;
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				String t = sdf.format(new Date(releaseTime));
				info += MmochatUtil.wrapColor(t + "解除认主\n", Color.red);
				break;
			}
			default:
				break;
			}
			if (superMachineType == MmochatSuperMachineType.神行法宝) {
				String title = getFlyMachineName(flyMachineSpeedLevel);
				if (flyMachineSpeedLevel == 3 && flyMachineFlyLevel == 5) {
					title += "(飞行形态)";
				}
				info += MmochatUtil.wrapColor(title, Color.yellow) + "\n";
				info += MmochatUtil.wrapIcon(getBmpId()) + "\n";
				info += "类型：" + superMachineType.toString() + "\n";
				info += "等级：" + (flyMachineSpeedLevel + flyMachineFlyLevel)
						+ "级\n";
				info += "移动：" + flyMachineSpeedLevel + "阶\n";
				info += "腾空：" + flyMachineFlyLevel + "阶\n";
				info += "体力："
						+ (flyMachineCanUseValue > 0 ? flyMachineCanUseValue
								: "0") + "\n";
				info += "消耗：每小时"
						+ getFlyMachineUsePerHour(flyMachineSpeedLevel,
								flyMachineFlyLevel) + "体力\n";
				info += "升级灵气："
						+ flyMachineExp
						+ "/"
						+ getFlyMachineUplevelNeed(flyMachineSpeedLevel,
								flyMachineFlyLevel) + "\n\n";

				Color attrColor;
				if (flyMachineCanUseValue > 0) {
					attrColor = Color.cyan;
				} else {
					attrColor = Color.gray;
				}
				switch (flyMachineSpeedLevel) {
				case 1:
					info += MmochatUtil.wrapColor("行走速度+28%", attrColor);
					break;
				case 2:
					info += MmochatUtil.wrapColor("行走速度+43%", attrColor);
					break;
				case 3:
					info += MmochatUtil.wrapColor("行走速度+57%", attrColor);
					break;
				default:
					break;
				}
				for (MmochatEquipAttribute attr : flyMachineAttr) {
					info += "\n"
							+ MmochatUtil.wrapColor(attr.getType()
									.getStartInfo()
									+ "+"
									+ attr.getValue()
									+ attr.getType().getEndInfo(), attrColor);
				}
				if (flyMachineCanUseValue <= 0) {
					info += "\n"
							+ MmochatUtil
									.wrapColor("(体力不足，效果未激活)", Color.green);
				}
			} else if (superMachineType == MmochatSuperMachineType.武魂) {
				info += MmochatUtil.wrapColor(superMachineType.toString(),
						Color.yellow)
						+ "\n";
				info += MmochatUtil.wrapIcon(getBmpId()) + "\n";
				String star = "";
				for (int i = 0; i < pkMachineStar; i++) {
					star += "★";
				}
				String rateInfo = "";
				Color starColor = Color.white;
				if (pkMachineStar < 3) {
					// 1,2
					starColor = Color.white;
					rateInfo = "普普通通";
				} else if (pkMachineStar == 3) {
					// 3
					starColor = Color.green;
					rateInfo = "较为常见";
				} else if (pkMachineStar == 4) {
					// 4
					starColor = Color.magenta;
					rateInfo = "百里挑一";
				} else {
					// >=5
					starColor = Color.yellow;
					rateInfo = "千里挑一";
				}
				info += MmochatUtil.wrapColor("品质:", Color.green)
						+ MmochatUtil.wrapColor(star, starColor) + "\n";
				info += MmochatUtil.wrapColor("掉落机率:", Color.green) + rateInfo
						+ "\n";
				info += MmochatUtil.wrapColor("可镶嵌技能石:", Color.green)
						+ pkMachineStar + "\n";
				int skillCount = 0;
				MmochatEquipAttribute minBaseAttr = null;
				String skillInfo = "";
				for (MmochatCommonObject stone : pkMachineSkills) {
					if (stone != null) {
						if (stone.getPkStoneBaseAttr() != null) {
							if (minBaseAttr == null) {
								minBaseAttr = stone.getPkStoneBaseAttr();
							} else if (minBaseAttr.getValue() > stone
									.getPkStoneBaseAttr().getValue()) {
								minBaseAttr = stone.getPkStoneBaseAttr();
							}
						}

						if (stone.getPkStoneAttr() != null) {
							skillInfo += MmochatUtil
									.wrapColor("("
											+ stone.getPropLevel()
											+ "级)"
											+ stone.getPkStoneAttr().getType()
													.getStartInfo()
											+ "+"
											+ stone.getPkStoneAttr().getValue()
											+ stone.getPkStoneAttr().getType()
													.getEndInfo() + "\n",
											Color.magenta);
							skillCount++;
						}
					}
				}
				if (minBaseAttr != null) {
					info += MmochatUtil.wrapColor("基础类型:", Color.green)
							+ minBaseAttr.getType().getStartInfo() + "+"
							+ minBaseAttr.getValue()
							+ minBaseAttr.getType().getEndInfo() + "\n";
				}
				info += skillInfo;

				for (int i = skillCount; i < pkMachineStar; i++) {
					info += "未镶嵌\n";
				}
			} else {
				info += superMachineType.toString();
			}
			return info;
		}
		case 宠物: {
			if (pet != null) {
				String info = "";
				int level = pet.getLevel();
				int blood_protential = (int) (pet.getBlood_protential() * (1 + pet
						.getBloodExtraPercent()));
				int physicalAttack_protential = (int) (pet
						.getPhysicalAttack_protential() * (1 + pet
						.getPhysicalExtraPercent()));
				int magicAttack_protential = (int) (pet
						.getMagicAttack_protential() * (1 + pet
						.getMagicExtraPercent()));
				int speed_protential = (int) (pet.getSpeed_protential() * (1 + pet
						.getSpeedExtraPercent()));
				int physicalDefend_protential = pet
						.getPhysicalDefend_protential();
				int magicDefend_protential = pet.getMagicDefend_protential();

				if (borrowFromRoleId != null) {
					info += MmochatUtil.wrapColor("出借者ID:"
							+ Integer.toHexString(borrowFromRoleId * 3) + "\n",
							Color.red);
				}

				if (isInShop) {
					info += MmochatUtil.wrapColor("出售单价:\n"
							+ MmochatUtil.getColorMoney(sellPrice)
							+ "文钱\n￣￣￣￣￣￣￣￣￣￣\n", Color.yellow);
				}

				switch (ownerState) {
				case 未认主: {
					if (bind) {
						info += MmochatUtil
								.wrapColor("已绑定,不可遗弃\n", Color.green);
					}
					break;
				}
				case 已认主: {
					info += MmochatUtil.wrapColor("已认主,不可交易或遗弃\n", Color.green);
					break;
				}
				case 解除认主中: {
					long releaseTime = releaseOwnerStartTime
							+ MmochatConstant.releaseOwnerInterval;
					SimpleDateFormat sdf = new SimpleDateFormat(
							"yyyy-MM-dd HH:mm");
					String t = sdf.format(new Date(releaseTime));
					info += MmochatUtil.wrapColor(t + "解除认主\n", Color.red);
					break;
				}
				default:
					break;
				}

				info += MmochatUtil.wrapColor(pet.getPetTypeName() + "("
						+ level + "级)\n", Color.yellow);
				info += MmochatUtil.wrapColor("气血：" + pet.getTotalBlood()
						+ "\n" + "法力：" + pet.getTotalSprit() + "\n" + "物伤："
						+ pet.getPhysicalAttack() + "\n" + "法伤："
						+ pet.getSpritAttack() + "\n" + "速度：" + pet.getSpeed()
						+ "\n" + "武学：" + pet.getDao() + "\n", Color.white);
				info += MmochatUtil
						.wrapColor(
								"成长："
										+ (blood_protential
												+ physicalAttack_protential
												+ magicAttack_protential
												+ speed_protential
												+ physicalDefend_protential + magicDefend_protential)
										+ "\n", Color.cyan);
				info += MmochatUtil.wrapColor("血量成长：" + blood_protential + "\n"
						+ "物攻成长：" + physicalAttack_protential + "\n" + "法攻成长："
						+ magicAttack_protential + "\n" + "速度成长："
						+ speed_protential + "\n" + "物防成长："
						+ physicalDefend_protential + "\n" + "法防成长："
						+ magicDefend_protential + "\n", Color.green);
				info += MmochatUtil.wrapColor("属性：未分配(" + pet.getSpace_point()
						+ ")\n", Color.cyan);
				info += MmochatUtil.wrapColor("力量 " + pet.getAttack_point()
						+ " 灵力 " + pet.getSprit_point() + " 体力 "
						+ pet.getBlood_point() + " 敏捷  " + pet.getSpeed_point()
						+ "\n", Color.green);
				return info;
			}
			break;
		}
		default:
			break;
		}
		return objInfo;
	}

	// 是否已经用光
	public boolean isUsedOut() {
		if (objectType == MmochatObjectType.道具) {
			if (canOverlap) {
				return overlapNum <= 0;
			}
			return curPropAmount <= 0;
		} else {
			return overlapNum <= 0;
		}
	}

	public void use(int useAmount) {
		if (canOverlap) {
			overlapNum -= useAmount;
		} else {
			curPropAmount -= useAmount;
		}
	}

	public void addRandAttr(MmochatEquipAttribute attr) {
		if (attr != null) {
			equipRandAttr.add(attr);
		}
	}

	public void delAmount(int amount) {
		curPropAmount -= amount;
	}

	public MmochatCommonObjectType getType() {
		switch (objectType) {
		case 药品: {
			return drugType;
		}
		case 装备: {
			return equipType;
		}
		case 材料: {
			return materialType;
		}
		case 道具: {
			return propType;
		}
		case 法宝: {
			return superMachineType;
		}
		default:
			break;
		}
		return null;
	}

	public Color getColor() {
		switch (objectType) {
		case 药品: {
			return Color.white;
		}
		case 装备: {
			return equipQuality.getColor();
		}
		case 材料: {
			return Color.white;
		}
		case 道具: {
			return Color.yellow;
		}
		case 法宝: {
			return Color.yellow;
		}
		default:
			break;
		}
		return Color.white;
	}

	// 与终端统一
	public int getAttrValue() {
		int attr = 0;
		if (isCanOverlap()) {
			attr += 1;
		}
		if (isCanDeal()) {
			attr += 2; // 能否交易
		}
		// 能否回收
		if (canSell()) {
			attr += 4;
		}

		// 能否在战斗中使用
		if (canUseInBattle()) {
			attr += 8;
		}

		// 能否喂宠
		if (canFeedPet()) {
			attr += 16;
		}
		// 是否为宠物
		if (objectType == MmochatObjectType.宠物) {
			attr += 32;
		}
		return attr;
	}

	public String getObjInfo() {
		return objInfo;
	}

	public void setObjInfo(String objInfo) {
		this.objInfo = objInfo;
	}

	public int getObjBmpId() {
		return objBmpId;
	}

	public void setObjBmpId(int objBmpId) {
		this.objBmpId = objBmpId;
	}

	public MmochatPet getPet() {
		return pet;
	}

	public void setPet(MmochatPet pet) {
		this.pet = pet;
	}

	public boolean isBind() {
		return bind;
	}

	public void setBind(boolean bind) {
		this.bind = bind;
	}

	public int getLife_turn() {
		return life_turn;
	}

	public void setLife_turn(int lifeTurn) {
		life_turn = lifeTurn;
	}

	public void addLife_turn(int add) {
		life_turn += add;
		life_turn = Math.max(0, life_turn);
		life_turn = Math.min(life_turn, MmochatConstant.maxLifeTurn);
	}

	public MmochatSecondRoleType getSecond_role_type() {
		return second_role_type;
	}

	public void setSecond_role_type(MmochatSecondRoleType secondRoleType) {
		second_role_type = secondRoleType;
	}

	public Map<MmochatEquipAttributeType, MmochatEquipAttribute> getEquipLifeTurnAttr() {
		return equipLifeTurnAttr;
	}

	public void setEquipLifeTurnAttr(
			Map<MmochatEquipAttributeType, MmochatEquipAttribute> equipLifeTurnAttr) {
		this.equipLifeTurnAttr = new ConcurrentHashMap<MmochatEquipAttributeType, MmochatEquipAttribute>(
				equipLifeTurnAttr);
	}

	public MmochatObjOwnerState getOwnerState() {
		return ownerState;
	}

	public void setOwnerState(MmochatObjOwnerState ownerState) {
		this.ownerState = ownerState;
	}

	public long getReleaseOwnerStartTime() {
		return releaseOwnerStartTime;
	}

	public void setReleaseOwnerStartTime(long releaseOwnerStartTime) {
		this.releaseOwnerStartTime = releaseOwnerStartTime;
	}

	public Integer getPropLevel() {
		return propLevel;
	}

	public void setPropLevel(Integer propLevel) {
		this.propLevel = propLevel;
	}

	public void addPropLevel(int add) {
		propLevel += add;
	}

	public Long getStartTick() {
		return startTick;
	}

	public void setStartTick(Long startTick) {
		this.startTick = startTick;
	}

	public Integer getBorrowFromRoleId() {
		return borrowFromRoleId;
	}

	public void setBorrowFromRoleId(Integer borrowFromRoleId) {
		this.borrowFromRoleId = borrowFromRoleId;
	}

	public static int getFlyMachineMaxSpeedLevel() {
		return flyMachineMaxSpeedLevel;
	}

	public static void setFlyMachineMaxSpeedLevel(int flyMachineMaxSpeedLevel) {
		MmochatCommonObject.flyMachineMaxSpeedLevel = flyMachineMaxSpeedLevel;
	}

	public static int getFlyMachineMaxFlyLevel() {
		return flyMachineMaxFlyLevel;
	}

	public static void setFlyMachineMaxFlyLevel(int flyMachineMaxFlyLevel) {
		MmochatCommonObject.flyMachineMaxFlyLevel = flyMachineMaxFlyLevel;
	}

	public int getLevelLimit() {
		return levelLimit;
	}

	public void setLevelLimit(int levelLimit) {
		this.levelLimit = levelLimit;
	}

	public int getExp() {
		return exp;
	}

	public void setExp(int exp) {
		this.exp = exp;
	}

	public void addExp(int add) {
		exp += add;
	}

	public int getPkMachineStar() {
		return pkMachineStar;
	}

	public void setPkMachineStar(int pkMachineStar) {
		this.pkMachineStar = pkMachineStar;
	}

	public List<MmochatCommonObject> getPkMachineSkills() {
		return pkMachineSkills;
	}

	public void setPkMachineSkills(List<MmochatCommonObject> pkMachineSkills) {
		this.pkMachineSkills = pkMachineSkills;
	}

	public MmochatEquipAttribute getPkStoneAttr() {
		return pkStoneAttr;
	}

	public void setPkStoneAttr(MmochatEquipAttribute pkStoneAttr) {
		this.pkStoneAttr = pkStoneAttr;
	}

	public MmochatEquipAttribute getPkStoneBaseAttr() {
		return pkStoneBaseAttr;
	}

	public void setPkStoneBaseAttr(MmochatEquipAttribute pkStoneBaseAttr) {
		this.pkStoneBaseAttr = pkStoneBaseAttr;
	}

	// 药品排序
	public static class sortDrug implements Comparator<MmochatCommonObject> {
		// 降序
		@Override
		public int compare(MmochatCommonObject arg0, MmochatCommonObject drug) {
			MmochatDrugType drugType = arg0.getDrugType();
			if (drugType.getBlood() > 0 && drug.getDrugType().getBlood() > 0) {
				// 血药之间
				return drug.getDrugType().getBlood() - drugType.getBlood();
			} else if (drugType.getSprit() > 0
					&& drug.getDrugType().getSprit() > 0) {
				// 蓝药之间
				return drug.getDrugType().getSprit() - drugType.getSprit();
			} else {
				// 血药与蓝药
				if (drugType.getBlood() > 0) {
					return -1;
				}
				return 1;
			}
		}

	}

	// 道具排序
	public static class sortProp implements Comparator<MmochatCommonObject> {
		@Override
		public int compare(MmochatCommonObject arg0, MmochatCommonObject arg1) {
			return arg0.getPropType().getEffectKey()
					- arg1.getPropType().getEffectKey();
		}
	}

	// 材料排序
	public static class sortMaterial implements Comparator<MmochatCommonObject> {
		@Override
		public int compare(MmochatCommonObject arg0, MmochatCommonObject arg1) {
			return arg0.getMaterialType().getValue()
					- arg1.getMaterialType().getValue();
		}
	}

}
